package com.scgl.depot.service.impl;

import com.scgl.depot.domain.Depot;
import com.scgl.depot.mapper.DepotMapper;
import com.scgl.depot.service.IDepotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 仓库Service业务层处理
 *
 * @author mobai
 * @date 2024-10-25
 */
@Service
public class DepotServiceImpl implements IDepotService
{
    @Autowired
    private DepotMapper depotMapper;

    /**
     * 查询仓库
     *
     * @param id 仓库主键
     * @return 仓库
     */
    @Override
    public Depot selectDepotById(Long id)
    {
        return depotMapper.selectDepotById(id);
    }

    /**
     * 查询仓库列表
     *
     * @param depot 仓库
     * @return 仓库
     */
    @Override
    public List<Depot> selectDepotList(Depot depot)
    {
        return depotMapper.selectDepotList(depot);
    }

    /**
     * 新增仓库
     *
     * @param depot 仓库
     * @return 结果
     */
    @Override
    public int insertDepot(Depot depot)
    {
        depot.setCreateTime(new Date());
        depot.setCreateName("张三");
        return depotMapper.insertDepot(depot);
    }

    /**
     * 修改仓库
     *
     * @param depot 仓库
     * @return 结果
     */
    @Override
    public int updateDepot(Depot depot)
    {
        return depotMapper.updateDepot(depot);
    }

    /**
     * 批量删除仓库
     *
     * @param ids 需要删除的仓库主键
     * @return 结果
     */
    @Override
    public int deleteDepotByIds(Long[] ids)
    {
        return depotMapper.deleteDepotByIds(ids);
    }

    /**
     * 删除仓库信息
     *
     * @param id 仓库主键
     * @return 结果
     */
    @Override
    public int deleteDepotById(Long id)
    {
        return depotMapper.deleteDepotById(id);
    }
}
